<template>
  <div id="salelist"> 


          <el-table :data="saledata" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">

                 <el-table-column label="处理时间"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.updatetime }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="申请时间"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.createtime }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="ID"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.uid }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="用户名"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="手机号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.telphone }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="冻结原因"  align='center' >                   
                    <template slot-scope="scope">                   
                         <span  v-if="scope.row.type == 'KMB_TRADE'">果米购买冻结</span>
                        <span  v-if="scope.row.type == 'GOODS_TRADE'">买地购买冻结</span>
                        <span  v-if="scope.row.type == 'CREDIT_COLD'">信用积分购买冻结</span>
                    </template>
                </el-table-column>
                <el-table-column label="冻结状态"  align='center'>                   
                    <template slot-scope="scope">                   
                        <span  v-if="scope.row.status == 0">待处理</span>
                        <span  v-if="scope.row.status == 1">已同意</span>
                        <span  v-if="scope.row.status == 2">已拒绝</span>
                    </template>
                </el-table-column>
                 <el-table-column label="冻结凭证"  align='center' >                   
                    <template slot-scope="scope">                   
                         <el-image  
                                v-if="scope.row.voucher_link"
                                :src="urlimg + scope.row.voucher_link" 
                                :preview-src-list="scope.row.voucher_linkList" class="imga" style="width:30px;height:30px;">
                          </el-image>
                    </template>
                </el-table-column>

         
                 <el-table-column label="操作" align='center' width="170px">
                    <template slot-scope="scope" v-if="scope.row.status == 0">
                        <el-button size="mini"  type="primary" class="button_class1"  plain @click="agree_but(scope.row)">同意</el-button> 
                        <el-button size="mini"  type="primary" class="button_class2" plain @click="refuse_but(scope.row)">拒绝</el-button> 
                    </template>
                </el-table-column>
  
            </el-table>  




   </div>
</template>

<script>

export default {
   name: 'salelist',
   props:{
      saledata:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 353
      
  },
  mounted (){
    
  },
  methods: {
    
    agree_but(row){

         this.$confirm('同意解冻, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {

              this.post("/thaw_apply/agree", {
                orderno:row.orderno,
              }).then(res => {
                if(res.error_code == 0){
                    this.open1(res.result,'success')  //提示框
                    this.$emit('up_list_fun')
                }else {
                this.open1(res.message,'warning')
                }

            })

        })

        
    },

    refuse_but(row){

         this.$confirm('拒绝解冻, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {

              this.post("/thaw_apply/refuse", {
                orderno:row.orderno,
              }).then(res => {
                if(res.error_code == 0){
                    this.open1(res.result,'success')  //提示框
                    this.$emit('up_list_fun')
                }else {
                this.open1(res.message,'warning')
                }

            })

        })

        
    },

  }
}
</script>


<style scoped>
.imga>>>.el-icon-circle-close {
      color: white;
    }

</style>